class Solution(object):
    def guessNumber(self, n):
        """
        :type n: int
        :rtype: int
        """
        l = 1
        h = n
        while l <= h:
            mid = l + (h - l) / 2
            res = guess(mid) 
            if res == 0:
                return mid
            
            if res == -1:
                h = mid - 1
            else:
                l = mid + 1
